package com.sky.mapper.common;

import com.github.pagehelper.Page;
import com.sky.aop.anno.AutoFill;
import com.sky.constant.StatusConstant;
import com.sky.dto.DishDTO;
import com.sky.dto.DishPageQueryDTO;
import com.sky.enumeration.OperationType;
import com.sky.pojo.Dish;
import com.sky.result.PageResult;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishMapper {

    Long countByStatusAndIds(@Param("status") Integer status,@Param("ids") List<Long> ids);

    void deleteBatch(List<Long> ids);


    Page<DishVO> selectPageByNameAndType(DishPageQueryDTO dishPageQueryDTO);

    /**
     * 根据分类id查询菜品数量
     * @param categoryId
     * @return
     */
    @Select("select count(id) from dish where category_id = #{categoryId}")
    Integer countByCategoryId(Long categoryId);

    @AutoFill(OperationType.INSERT)
//    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insert(Dish dish);



}
